package com.example.xitong;

import android.os.Bundle;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentTransaction;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;


public class Shouye extends Fragment {

    TextView ss1,ss2,ss3,ss4;

    View view;

    school scl=new school();
    dt dtl=new dt();
    tc tcl=new tc();
    tuijian tjl=new tuijian();


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view=inflater.inflate(R.layout.fragment_shouye, container, false);
        ss1=view.findViewById(R.id.s1);
        ss2=view.findViewById(R.id.s2);
        ss3=view.findViewById(R.id.s3);
        ss4=view.findViewById(R.id.s4);



        getChildFragmentManager().beginTransaction().add(R.id.syfragment,tjl).commit();
        getChildFragmentManager().beginTransaction().add(R.id.syfragment,scl).commit();
        getChildFragmentManager().beginTransaction().add(R.id.syfragment,dtl).commit();
        //getChildFragmentManager().beginTransaction().add(R.id.syfragment,tcl).commit();

        getChildFragmentManager().beginTransaction().show(tjl).hide(scl).hide(dtl).hide(tcl).commit();
       ss1.setTextColor(getResources().getColor(R.color.purple_200));

        setC1(view);

        return view;
    }

    public void setC1(View view) {
        this.view=view;


        ss1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getChildFragmentManager().beginTransaction().show(tjl).hide(scl).hide(dtl).hide(tcl).commit();
                ss1.setTextColor(getResources().getColor(R.color.purple_200));
                ss2.setTextColor(getResources().getColor(R.color.black));
                ss3.setTextColor(getResources().getColor(R.color.black));
                ss4.setTextColor(getResources().getColor(R.color.black));
            }
        });

        ss2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getChildFragmentManager().beginTransaction().show(scl).hide(tjl).hide(dtl).hide(tcl).commit();
                ss2.setTextColor(getResources().getColor(R.color.purple_200));
                ss1.setTextColor(getResources().getColor(R.color.black));
                ss3.setTextColor(getResources().getColor(R.color.black));
                ss4.setTextColor(getResources().getColor(R.color.black));
            }
        });

        ss3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getChildFragmentManager().beginTransaction().show(dtl).hide(scl).hide(tjl).hide(tcl).commit();
                ss3.setTextColor(getResources().getColor(R.color.purple_200));
                ss2.setTextColor(getResources().getColor(R.color.black));
                ss1.setTextColor(getResources().getColor(R.color.black));
                ss4.setTextColor(getResources().getColor(R.color.black));
            }
        });

//        ss4.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                getChildFragmentManager().beginTransaction().show(tcl).hide(scl).hide(dtl).hide(tjl).commit();
//                ss4.setTextColor(getResources().getColor(R.color.purple_200));
//                ss2.setTextColor(getResources().getColor(R.color.black));
//                ss3.setTextColor(getResources().getColor(R.color.black));
//                ss1.setTextColor(getResources().getColor(R.color.black));
//            }
//        });







    }
}